package com.fml.ft_study.service;

import com.fml.ft_study.dao.MutilTableBeanDAO;
import com.fml.ft_study.domain.MutilTableBean;
import org.junit.Test;

import java.util.List;

public class MutilTableService {

    private MutilTableBeanDAO mutilTableBeanDAO=new MutilTableBeanDAO();
    //显示多表联合查询显示账单，并显示菜名
    public List<MutilTableBean>list(){

        List<MutilTableBean> mutilTableBeans = mutilTableBeanDAO.queryMulti("SELECT bill.*,menu.`name` FROM  bill,menu WHERE  bill.menuId=menu.id;", MutilTableBean.class);
        return  mutilTableBeans;
    }
    @Test
    public  void test(){
        List<MutilTableBean> list = list();
        for (MutilTableBean mutilTableBean : list) {
            System.out.println(mutilTableBean.toString());
        }
    }

}
